package yxy.cherry.battle.module.actor;

import yxy.cherry.battle.Battle;
import yxy.cherry.battle.Fighter;
import yxy.cherry.battle.module.affix.Buff;
import yxy.cherry.battle.module.record.stream.RecordStream_RND;

public class Actor_下一轮 extends Actor {

	@Override
	public void doAct() {
		int round = getContext().stepRound();
		getRecord().info("Round " + round);

		Battle.battleLogger(1,"Round"+round);
		// 流脚本
		getRecord().stream(new RecordStream_RND(round)).record();
		if((round>1)) {
			for (Fighter fighter : getContext().getTeamA().getFighters()) {
				for (String key : fighter.getBuffMap().keySet()) {
					Buff buff = fighter.getBuffMap().get(key);
					if (buff.getRoundCountType() == Buff.ROUND_COUNT_TYPE_FOR_ROUND) {
						buff.tick();
						Battle.battleLogger(3, "Buff回合按回合，用户A：" + fighter.getName() + "tick" + buff.getBuffCode() + buff.getSkilldata().getName()+"  "+buff.getSkilldata().getDescribe() + "剩余回合：" + buff.getRound());
					}
				}
			}
			for (Fighter fighter : getContext().getTeamB().getFighters()) {
				for (String key : fighter.getBuffMap().keySet()) {
					Buff buff = fighter.getBuffMap().get(key);
					if (buff.getRoundCountType() == Buff.ROUND_COUNT_TYPE_FOR_ROUND) {
						buff.tick();
						Battle.battleLogger(3, "Buff回合按回合，用户B：" + fighter.getName() + "tick" + buff.getBuffCode() + buff.getSkilldata().getName() +"  "+buff.getSkilldata().getDescribe() + "剩余回合：" + buff.getRound());
					}
				}
			}
		}


	}

	@Override
	public boolean canAct() {
		int round = getContext().getRound();
		if (getContext().roundLimit(round + 1)) {
			getContext().stepRound();
			return false;
		}
		return true;
	}

}
